home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tptc16.zip / DIAL.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-04  |  1KB  |  63 lines

  1.  
  2. program Dial;
  3.   {dials number on command line to Hayes compatible modem on COM1}
  4.  
  5. (*
  6.    Usage: DIAL xxx-xxxx
  7. *)
  8.  
  9. const
  10.   Com_Base = $3F8;            {Use 3F8 for COM1, 2F8 for COM2}
  11.  
  12.   {Offsets from Com_Base for async control ports             }
  13.   RX = 0;                     {Receiver Buffer Register      }
  14.   TX = 0;                     {Transmitter Buffer Register   }
  15.   LC = 3;                     {Line Control Register         }
  16.   MC = 4;                     {Modem Control Register        }
  17.   LS = 5;                     {Line Status Register          }
  18.   DLL = 0;                    {Divisor Latch, Low Order Byte }
  19.   DLH = 1;                    {Divisor Latch, High Order Byte}
  20.  
  21.   No_Parity = $03;
  22.  
  23. type
  24.    anystring = string[80];
  25.  
  26.  
  27. procedure send(command: anystring);
  28. var
  29.    P: integer;
  30.    C: char;
  31.    I: integer;
  32.  
  33. begin
  34.  
  35.   {send string to modem}
  36.   for P := 1 to length(command) do
  37.   begin
  38.     C := command[P];
  39.     Port[com_base+TX] := C;
  40.     repeat
  41.     until Port[com_base+LS] >= $20;
  42.     P := Succ(P);
  43.  
  44.     I := 0;
  45.     repeat
  46.       I := Succ(I);
  47.     until I >= 1000;
  48.   end;
  49. end;
  50.  
  51.  
  52. begin
  53.   {init modem}
  54.   Port[com_base+LC] := $83; {Set baud rate, No parity, 8 bits}
  55.   Port[com_base+DLL] := 96; {1200 baud}
  56.   Port[com_base+DLH] := 0;
  57.   Port[com_base+LC] := No_Parity;
  58.   Port[com_base+MC] := $03; {Turn ON DTR and RTS}
  59.  
  60.   {set up modem control string}
  61.   send('ATDT' + paramstr(1) + ^M);
  62. end.
  63.